/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.karelun.ideaboard.core.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.karelun.ideaboard.core.Colorable;
import org.karelun.ideaboard.core.CorePackage;
import org.karelun.ideaboard.core.Decorator;
import org.karelun.ideaboard.core.LineType;
import org.karelun.ideaboard.core.Point;
import org.karelun.ideaboard.core.Prismatic;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Prismatic</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.karelun.ideaboard.core.impl.PrismaticImpl#getColor <em>Color</em>}</li>
 *   <li>{@link org.karelun.ideaboard.core.impl.PrismaticImpl#getLineStyle <em>Line Style</em>}</li>
 *   <li>{@link org.karelun.ideaboard.core.impl.PrismaticImpl#getLineWidth <em>Line Width</em>}</li>
 *   <li>{@link org.karelun.ideaboard.core.impl.PrismaticImpl#getTopPointA <em>Top Point A</em>}</li>
 *   <li>{@link org.karelun.ideaboard.core.impl.PrismaticImpl#getTopPointB <em>Top Point B</em>}</li>
 *   <li>{@link org.karelun.ideaboard.core.impl.PrismaticImpl#getTopPointC <em>Top Point C</em>}</li>
 *   <li>{@link org.karelun.ideaboard.core.impl.PrismaticImpl#getTopPointD <em>Top Point D</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PrismaticImpl extends DiagramImpl implements Prismatic {
	/**
	 * The default value of the '{@link #getColor() <em>Color</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getColor()
	 * @generated
	 * @ordered
	 */
	protected static final int COLOR_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getColor() <em>Color</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getColor()
	 * @generated
	 * @ordered
	 */
	protected int color = COLOR_EDEFAULT;

	/**
	 * The default value of the '{@link #getLineStyle() <em>Line Style</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLineStyle()
	 * @generated
	 * @ordered
	 */
	protected static final LineType LINE_STYLE_EDEFAULT = LineType.SOLID;

	/**
	 * The cached value of the '{@link #getLineStyle() <em>Line Style</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLineStyle()
	 * @generated
	 * @ordered
	 */
	protected LineType lineStyle = LINE_STYLE_EDEFAULT;

	/**
	 * The default value of the '{@link #getLineWidth() <em>Line Width</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLineWidth()
	 * @generated
	 * @ordered
	 */
	protected static final int LINE_WIDTH_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getLineWidth() <em>Line Width</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLineWidth()
	 * @generated
	 * @ordered
	 */
	protected int lineWidth = LINE_WIDTH_EDEFAULT;

	/**
	 * The cached value of the '{@link #getTopPointA() <em>Top Point A</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTopPointA()
	 * @generated
	 * @ordered
	 */
	protected Point topPointA;

	/**
	 * The cached value of the '{@link #getTopPointB() <em>Top Point B</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTopPointB()
	 * @generated
	 * @ordered
	 */
	protected Point topPointB;

	/**
	 * The cached value of the '{@link #getTopPointC() <em>Top Point C</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTopPointC()
	 * @generated
	 * @ordered
	 */
	protected Point topPointC;

	/**
	 * The cached value of the '{@link #getTopPointD() <em>Top Point D</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTopPointD()
	 * @generated
	 * @ordered
	 */
	protected Point topPointD;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PrismaticImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CorePackage.Literals.PRISMATIC;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getColor() {
		return color;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setColor(int newColor) {
		int oldColor = color;
		color = newColor;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.PRISMATIC__COLOR, oldColor, color));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LineType getLineStyle() {
		return lineStyle;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLineStyle(LineType newLineStyle) {
		LineType oldLineStyle = lineStyle;
		lineStyle = newLineStyle == null ? LINE_STYLE_EDEFAULT : newLineStyle;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.PRISMATIC__LINE_STYLE, oldLineStyle, lineStyle));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getLineWidth() {
		return lineWidth;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLineWidth(int newLineWidth) {
		int oldLineWidth = lineWidth;
		lineWidth = newLineWidth;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.PRISMATIC__LINE_WIDTH, oldLineWidth, lineWidth));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Point getTopPointA() {
		if (topPointA != null && topPointA.eIsProxy()) {
			InternalEObject oldTopPointA = (InternalEObject)topPointA;
			topPointA = (Point)eResolveProxy(oldTopPointA);
			if (topPointA != oldTopPointA) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.PRISMATIC__TOP_POINT_A, oldTopPointA, topPointA));
			}
		}
		return topPointA;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Point basicGetTopPointA() {
		return topPointA;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTopPointA(Point newTopPointA) {
		Point oldTopPointA = topPointA;
		topPointA = newTopPointA;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.PRISMATIC__TOP_POINT_A, oldTopPointA, topPointA));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Point getTopPointB() {
		if (topPointB != null && topPointB.eIsProxy()) {
			InternalEObject oldTopPointB = (InternalEObject)topPointB;
			topPointB = (Point)eResolveProxy(oldTopPointB);
			if (topPointB != oldTopPointB) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.PRISMATIC__TOP_POINT_B, oldTopPointB, topPointB));
			}
		}
		return topPointB;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Point basicGetTopPointB() {
		return topPointB;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTopPointB(Point newTopPointB) {
		Point oldTopPointB = topPointB;
		topPointB = newTopPointB;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.PRISMATIC__TOP_POINT_B, oldTopPointB, topPointB));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Point getTopPointC() {
		if (topPointC != null && topPointC.eIsProxy()) {
			InternalEObject oldTopPointC = (InternalEObject)topPointC;
			topPointC = (Point)eResolveProxy(oldTopPointC);
			if (topPointC != oldTopPointC) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.PRISMATIC__TOP_POINT_C, oldTopPointC, topPointC));
			}
		}
		return topPointC;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Point basicGetTopPointC() {
		return topPointC;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTopPointC(Point newTopPointC) {
		Point oldTopPointC = topPointC;
		topPointC = newTopPointC;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.PRISMATIC__TOP_POINT_C, oldTopPointC, topPointC));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Point getTopPointD() {
		if (topPointD != null && topPointD.eIsProxy()) {
			InternalEObject oldTopPointD = (InternalEObject)topPointD;
			topPointD = (Point)eResolveProxy(oldTopPointD);
			if (topPointD != oldTopPointD) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.PRISMATIC__TOP_POINT_D, oldTopPointD, topPointD));
			}
		}
		return topPointD;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Point basicGetTopPointD() {
		return topPointD;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTopPointD(Point newTopPointD) {
		Point oldTopPointD = topPointD;
		topPointD = newTopPointD;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.PRISMATIC__TOP_POINT_D, oldTopPointD, topPointD));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CorePackage.PRISMATIC__COLOR:
				return getColor();
			case CorePackage.PRISMATIC__LINE_STYLE:
				return getLineStyle();
			case CorePackage.PRISMATIC__LINE_WIDTH:
				return getLineWidth();
			case CorePackage.PRISMATIC__TOP_POINT_A:
				if (resolve) return getTopPointA();
				return basicGetTopPointA();
			case CorePackage.PRISMATIC__TOP_POINT_B:
				if (resolve) return getTopPointB();
				return basicGetTopPointB();
			case CorePackage.PRISMATIC__TOP_POINT_C:
				if (resolve) return getTopPointC();
				return basicGetTopPointC();
			case CorePackage.PRISMATIC__TOP_POINT_D:
				if (resolve) return getTopPointD();
				return basicGetTopPointD();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CorePackage.PRISMATIC__COLOR:
				setColor((Integer)newValue);
				return;
			case CorePackage.PRISMATIC__LINE_STYLE:
				setLineStyle((LineType)newValue);
				return;
			case CorePackage.PRISMATIC__LINE_WIDTH:
				setLineWidth((Integer)newValue);
				return;
			case CorePackage.PRISMATIC__TOP_POINT_A:
				setTopPointA((Point)newValue);
				return;
			case CorePackage.PRISMATIC__TOP_POINT_B:
				setTopPointB((Point)newValue);
				return;
			case CorePackage.PRISMATIC__TOP_POINT_C:
				setTopPointC((Point)newValue);
				return;
			case CorePackage.PRISMATIC__TOP_POINT_D:
				setTopPointD((Point)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CorePackage.PRISMATIC__COLOR:
				setColor(COLOR_EDEFAULT);
				return;
			case CorePackage.PRISMATIC__LINE_STYLE:
				setLineStyle(LINE_STYLE_EDEFAULT);
				return;
			case CorePackage.PRISMATIC__LINE_WIDTH:
				setLineWidth(LINE_WIDTH_EDEFAULT);
				return;
			case CorePackage.PRISMATIC__TOP_POINT_A:
				setTopPointA((Point)null);
				return;
			case CorePackage.PRISMATIC__TOP_POINT_B:
				setTopPointB((Point)null);
				return;
			case CorePackage.PRISMATIC__TOP_POINT_C:
				setTopPointC((Point)null);
				return;
			case CorePackage.PRISMATIC__TOP_POINT_D:
				setTopPointD((Point)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CorePackage.PRISMATIC__COLOR:
				return color != COLOR_EDEFAULT;
			case CorePackage.PRISMATIC__LINE_STYLE:
				return lineStyle != LINE_STYLE_EDEFAULT;
			case CorePackage.PRISMATIC__LINE_WIDTH:
				return lineWidth != LINE_WIDTH_EDEFAULT;
			case CorePackage.PRISMATIC__TOP_POINT_A:
				return topPointA != null;
			case CorePackage.PRISMATIC__TOP_POINT_B:
				return topPointB != null;
			case CorePackage.PRISMATIC__TOP_POINT_C:
				return topPointC != null;
			case CorePackage.PRISMATIC__TOP_POINT_D:
				return topPointD != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
		if (baseClass == Colorable.class) {
			switch (derivedFeatureID) {
				case CorePackage.PRISMATIC__COLOR: return CorePackage.COLORABLE__COLOR;
				default: return -1;
			}
		}
		if (baseClass == Decorator.class) {
			switch (derivedFeatureID) {
				case CorePackage.PRISMATIC__LINE_STYLE: return CorePackage.DECORATOR__LINE_STYLE;
				case CorePackage.PRISMATIC__LINE_WIDTH: return CorePackage.DECORATOR__LINE_WIDTH;
				default: return -1;
			}
		}
		return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
		if (baseClass == Colorable.class) {
			switch (baseFeatureID) {
				case CorePackage.COLORABLE__COLOR: return CorePackage.PRISMATIC__COLOR;
				default: return -1;
			}
		}
		if (baseClass == Decorator.class) {
			switch (baseFeatureID) {
				case CorePackage.DECORATOR__LINE_STYLE: return CorePackage.PRISMATIC__LINE_STYLE;
				case CorePackage.DECORATOR__LINE_WIDTH: return CorePackage.PRISMATIC__LINE_WIDTH;
				default: return -1;
			}
		}
		return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (color: ");
		result.append(color);
		result.append(", lineStyle: ");
		result.append(lineStyle);
		result.append(", lineWidth: ");
		result.append(lineWidth);
		result.append(')');
		return result.toString();
	}

} //PrismaticImpl
